
pub mod lexer;
pub mod parser;

/// rule1 = %d98 CRLF
/// rule2 = %d98 rule1 CRLF
/// rule3 = rule2 %d98 CRLF
/// 
/// rule1 { name_or_content: "rule1", elements: [ {name_or_content: "a", elements: null } ] }
/// rule2 { name_or_content: "rule2", elements: [ {name_or_content: "a", elements: null }, rule1 ] }
/// rule3 { name_or_content: "rule3", elements: [ rule2, {name_or_content: "a", elements: null }  ] }
struct Rule
{
    name_or_content: String,    /// when elements == null, is content; else is name
    elements: Vec<Rule>
}


impl Rule
{
    fn new(name_or_content: String, elements: Vec<Rule>) -> Self
    {
        Self {
            name_or_content,
            elements
        }
    }


    pub fn read_rule(text: &str)
    {
        


    }
}




#[cfg(test)]
mod tests {
    use super::*;


    #[test]
    fn test_read_str_to_token_vec()
    {
        let v = lexer::Lexer::read_str_to_token_vec("rule1 = elem (foo / bar) blat");
        println!("{:#?}", v);
    }
}



